import pandas as pd


class UrbanizationReviewServer:
    """
    市民化审核部分
    """

    def __init__(self):
        # TODO 加载审核数据
        pass

    def 前一季度非外出从业但当前季度外出从业(self):
        """

        :return:
        """
        pre_task = 0
        now_task = 0
        suffix_pre_task_num = "q" + str(pre_task["TASK"][0])
        suffix_now_task_num = "q" + str(now_task["TASK"][0])
        # 两个季度内连接
        temp = pd.merge(pre_task, now_task, suffixes=[suffix_pre_task_num, suffix_now_task_num], on="SID+A100",
                        how="inner")
        temp = temp[(temp["N117" + suffix_pre_task_num] <= 5) & (temp["N117" + suffix_now_task_num] == 6)]
        temp = temp[["SID" + suffix_pre_task_num, "A100" + suffix_pre_task_num, "A101" + suffix_pre_task_num,
                     "N117" + suffix_pre_task_num, "N117" + suffix_now_task_num, "COUN" + suffix_pre_task_num]]
        temp.columns = ["SID", "A100", "A101", "N117_" + suffix_pre_task_num, "N117_" + suffix_now_task_num, "COUN"]
        temp["N117_" + suffix_pre_task_num] = temp["N117_" + suffix_pre_task_num].astype(int)
        temp["N117_" + suffix_now_task_num] = temp["N117_" + suffix_now_task_num].astype(int)
        return [suffix_pre_task_num[1:], suffix_now_task_num[1:], temp]
